package com.ziroom.finance.rabbitmq.common.enums;

import com.alibaba.fastjson.JSONObject;

import java.util.*;

/**
 * 短信状态枚举
 * @Author liyb58
 * @Date
 * @return
 */
public enum SmsStatusEnum {
    /**
     * 未查询
     */
    未查询("未查询", 0),
    /**
     * 成功
     */
    成功("成功", 1),
    /**
     * 失败
     */
    失败("失败", 2);
    private String name;
    private int index;

    private SmsStatusEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    /**
     * enum lookup map
     */
    public static final Map<Integer, String> lookup = new HashMap<Integer, String>();

    public static final List<JSONObject> list = new ArrayList<JSONObject>();


    static {
        for (SmsStatusEnum s : EnumSet.allOf(SmsStatusEnum.class)) {
            lookup.put(s.getIndex(), s.getName());
            JSONObject obj = new JSONObject();
            obj.put("code", s.getIndex());
            obj.put("nane", s.getName());
            list.add(obj);
        }
    }

    @Override
    public String toString() {
        return "{" +
                "name='" + name + '\'' +
                ", index=" + index +
                '}';
    }
}
